#ifndef _DECODEDSDIFF_H_
#define _DECODEDSDIFF_H_

#include "DecodeDSDFile.h"
#include <unistd.h>

class DecodeDSDIFF : public DecodeDSDFile
{
public:
    virtual ~DecodeDSDIFF(void);
    bool open(const std::string& file_name, double seek_seconds);
    uint64_t read(uint8_t* out, uint64_t size);

private:
    void fileJumpForward(uint64_t size)
    {
	ASSERT(lseek(file_, size, SEEK_CUR) >= 0, "Error seeking into file");
    }
    uint64_t filePos(void)
    {
	off_t cur = lseek(file_, 0, SEEK_CUR);
	ASSERT(cur >= 0, "Error getting file position");
	return (uint64_t)cur;
    }

    uint32_t sample_rate_;
    uint16_t channel_count_;
    uint64_t data_left_;
    int file_ = -1;

    struct ChunkHeader
    {
	uint8_t id[4];
	uint64_t size;
    } __attribute__ ((packed));
};

#endif
